<?php
class ControllerCommunityWarning extends Controller {
    public function index() {
        $this->language->load('community/warning');

        switch($this->session->data['warning_type']){
            case 'not_allow_view_forum':
                $this->document->setTitle($this->language->get('not_allow_view_forum_heading_title'));
                $this->data['heading_title'] = $this->language->get('not_allow_view_forum_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_not_allow_view_forum_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['warning_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'not_allow_view_topic':
                $this->document->setTitle($this->language->get('not_allow_view_topic_heading_title'));
                $this->data['heading_title'] = $this->language->get('not_allow_view_topic_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_not_allow_view_topic_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['warning_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'not_allow_action':
                $this->document->setTitle($this->language->get('not_allow_action_heading_title'));
                $this->data['heading_title'] = $this->language->get('not_allow_action_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_not_allow_action_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['warning_type']);
                unset($this->session->data['forwarded_link']);
                break;
            case 'already_reported':
                $this->document->setTitle($this->language->get('already_reported_heading_title'));
                $this->data['heading_title'] = $this->language->get('already_reported_heading_title');
                $this->data['text_message'] = sprintf($this->language->get('text_already_reported_message'), $this->session->data['forwarded_link']);
                header('refresh:5;url=' . str_replace('&amp;','&',$this->session->data['forwarded_link']));
                unset($this->session->data['warning_type']);
                unset($this->session->data['forwarded_link']);
                break;
        }

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home'),
            'separator' => false
        );

        $this->data['breadcrumbs'][]=array(
            'href'      =>      $this->url->link('community/community'),
            'text'      =>      $this->language->get('text_community'),
            'separator' =>      $this->language->get('text_separator')
        );

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_warning'),
            'href'      => $this->url->link('community/warning'),
            'separator' => $this->language->get('text_separator')
        );

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/community/warning.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/community/warning.tpl';
        } else {
            $this->template = 'default/template/community/warning.tpl';
        }

        $this->children = array(
            'common/column_left',
            'common/column_right',
            'common/content_top',
            'common/content_bottom',
            'common/footer',
            'common/header'
        );

        $this->response->setOutput($this->render());
    }
}
?>